home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
PROBLEMS
/
BENCHMARK
/
BUBBLESORT
/
bubbletest
/
assembler2
/
source
< prev
next >
Wrap
Text File
|
1992-06-17
|
3KB
|
145 lines
.ABSOLUTE
.PROC formula
; bubbletest.assembler.needed is FREEWARE, you may not sell it
.INCLUDE <bubble_assembler$dir>.needed
.MACRO bubblesort formularesult,a,length
LDR R9,[stackregister,#%2]
; array
LDR R10,[stackregister,#%3]
; length
MOV R10,R10,LSL#2
ADD R10,R10,R9
; end address
\whileloop
MOV R0,#1
MOV R1,R9
LDR R2,[R1],#4
\forloop
LDR R3,[R1],#4
CMP R2,R3
STRGT R2,[R1,#-4]
STRGT R3,[R1,#-8]
MOVGT R0,#0
MOVLS R2,R3
TEQ R1,R10
BNE \forloop
TEQ R0,#1
BNE \whileloop
.ENDM
restoreregister
goto jump
DEFSTORE a,formula_one*1000.*4.,0
jump
saveregister
STRINGconstload R1,'*wimpslot -min 7K -max 7K'
CHARPTRstackstore [stackregister,#16.],R1
STACKadd stackregister,stackregister,20.
system R0,-4.
STACKsub stackregister,stackregister,20.
INTconstload R1,123456.
INTregstore R0,R1
INTconstload R2,0.
INTregstore R1,R2
goto for2label4
forlabel4
INTconstload R2,1.
INTsum R2,R1,R2
INTregstore R1,R2
for2label4
INTconstload R2,1000.
INTless R2,R1,R2
ifnotgoto endforlabel4,R2
INTconstload R2,234567.
INTsum R2,R0,R2
INTconstload R3,567.
INTmodulo R2,R2,R3
INTconstload R3,345.
INTsum R2,R2,R3
INTregstore R0,R2
INTregstore R3,R1
INTconstmult R3,4
INTPTRconstload R4,a
INTsum R3,R3,R4
INTarraystore R3,R0
INTregstore R3,R1
INTconstmult R3,4
INTPTRconstload R4,a
INTsum R3,R3,R4
INTarrayload R3,R3
STMIA R12,{R0,R1,R3}
INTstackstore [stackregister,#28.],R3
STACKadd stackregister,stackregister,32.
writeint R2,-4.
STACKsub stackregister,stackregister,32.
LDMFD R12,{R0,R1,R3}
restoreregister
cr
saveregister
goto forlabel4
endforlabel4
STMIA R12,{R0,R1}
STRINGconstload R3,'show time1'
CHARPTRstackstore [stackregister,#24.],R3
STACKadd stackregister,stackregister,28.
system R2,-4.
STACKsub stackregister,stackregister,28.
LDMFD R12,{R0,R1}
STMIA R12,{R0,R1}
INTconstload R3,1000.
INTstackstore [stackregister,#24.],R3
INTPTRconstload R3,a
INTPTRstackstore [stackregister,#28.],R3
STACKadd stackregister,stackregister,32.
bubblesort R2,-4.,-8.
STACKsub stackregister,stackregister,32.
LDMFD R12,{R0,R1}
STMIA R12,{R0,R1}
STRINGconstload R3,'show time1'
CHARPTRstackstore [stackregister,#24.],R3
STACKadd stackregister,stackregister,28.
system R2,-4.
STACKsub stackregister,stackregister,28.
LDMFD R12,{R0,R1}
INTconstload R2,0.
INTregstore R1,R2
goto for2label5
forlabel5
INTconstload R2,1.
INTsum R2,R1,R2
INTregstore R1,R2
for2label5
INTconstload R2,1000.
INTless R2,R1,R2
ifnotgoto endforlabel5,R2
INTregstore R3,R1
INTconstmult R3,4
INTPTRconstload R4,a
INTsum R3,R3,R4
INTarrayload R3,R3
STMIA R12,{R0,R1,R3}
INTstackstore [stackregister,#28.],R3
STACKadd stackregister,stackregister,32.
writeint R2,-4.
STACKsub stackregister,stackregister,32.
LDMFD R12,{R0,R1,R3}
restoreregister
cr
saveregister
goto forlabel5
endforlabel5
restoreregister
SWI XOS_Exit
.END